package com.lei.datastructure.heep;

import java.util.Random;

/**
 * @Author LeiXiaoLei
 * @Date 2022/8/19 10:39
 * @Version 1.0
 */
public class Main {
    public static void main(String[] args) {
        int n = 1000000;
        MaxHeep<Integer> maxHeep = new MaxHeep<>();
        Random random = new Random();
        for (int i = 0; i <n; i++) {
            maxHeep.add(random.nextInt(Integer.MAX_VALUE));
        }
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = maxHeep.extractMax();
        }

        for (int i = 1; i < n; i++) {
            if (arr[i-1] < arr[i]) throw new IllegalArgumentException("Error");
        }
        System.out.println("Test MaxHeap completed");
    }
}
